<?php
class Pageley_Domain_Attribute_Reference extends Pageley_Domain_Attribute_Basic {

	private $type;

	public function __construct($name, $type = null, $validators = null) {
		parent::__construct($name, $validators);
		if($type != null) {
		    $this->addValidator(new Pageley_Domain_Validator_Type($type));
		}
		$this->type = $type;
	}

	public function isReference() {
		return true;
	}

	public function getType() {
		return $this->type;
	}

	public function setType($type) {
		$this->type = $type;
		$this->addValidator(new Pageley_Domain_Validator_Type($type));
	}

	public function newProperty() {
		return new Pageley_Domain_LazyReferenceProperty(null, $this->getType());
	}

}